package com.zhangfei.service;

import com.zhangfei.selector.PayTypeEnum;
import com.zhangfei.selector.PayHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * 付款单付款
 */
@Slf4j
public abstract class AbstractPayHandler implements PayHandler {


    @Override
    public PayTypeEnum getPayTypeEnum() {
        throw new UnsupportedOperationException();
    }

    @Override
    public String pay(String paymessage){
        //做一些公共的操作

        //定义获取信息-各种支付方法的抽象方法
        String message=doQueryMessage(paymessage);

        //定义保存数据--各种支付方法的抽象方法
        doSaveMessage(paymessage);

        return message;
    }

    protected abstract void doSaveMessage(String paymessage);

    protected abstract String doQueryMessage(String paymessage);


}
